Sustainability

Introduction

We all have a role to play in creating a sustainable future for ourselves and for generations to come. One of the most pressing issues we face today is the high level of energy consumption and the resulting impact on the environment. In 2021, the United States alone consumed a staggering 3,930 terawatt hours of energy, with a significant portion of it coming from non-renewable sources like fossil fuels. This has a detrimental effect on the environment, contributing to climate change, air and water pollution, and other environmental issues. Melting glaciers are threatening to flood our valuable land and cities. An estimated 15 million people around the world are at risk of suffering sudden, deadly, and destructive flooding events due to the warming climate. By caring about sustainability and making conscious choices about energy use, we can help to reduce our carbon footprint and create a more sustainable future.

At Amherst College, we have a responsibility to reduce our energy consumption and minimize our environmental impact. By reducing energy consumption, we can save money and preserve resources for future generations. In our analysis, we look at sustainability within a few freshman dorms at Amherst College. We then look at data across the world and compare energy consumption country-to-country. Our goal is to bring attention to just how much energy is consumed and consequently allow readers to analyze their own carbon footprints.

"Safe Space" by artist Kenesha Sneed

“Safe Space” by artist Kenesha Sneed

Why should anyone care about this?

The easy thing to do is to go about your life and pretend nothing is happening. Ignorance is bliss, right? If everyone reading this thought this way, our sustainability habits would worsen. Caring about sustainability and taking action to address climate change is not only important, it is absolutely crucial for the survival of our planet and all the living beings that call it home. Ignoring climate change and continuing with unsustainable practices not only harms the environment but also has serious social and economic consequences. We are already witnessing the devastating effects of climate change, including rising sea levels, more frequent and severe natural disasters, and the displacement of vulnerable populations. We cannot continue to turn a blind eye to these issues and expect things to get better on their own. It is our responsibility to take action and make the necessary changes in our daily lives, as well as advocate for systemic changes at a larger scale. By prioritizing sustainability and addressing climate change, we can create a better future for ourselves and for future generations.

Data Collection

The data from our Shiny App came from the Amherst College Office of Sustainability. As technology advances, the Sustainability Office has more access to resources that allow us to track energy consumption. In the newer dorms, the office is even able to track water usage. This data is not publicly available. As Amherst College students, we were able to meet with Weston Dripps, the Director of Sustainability. He kindly pulled the energy consumption data from North, South, James, and Stearns during the 2021-22 academic year. The original data is in an Excel file.

The worldwide data comes from Kaggle, a trusted web browser that gives users access to large, downloadable datasets. This dataset titled, “World Sustainability Dataset” tracks the sustainability of 173 countries over 19 years. We have data on the years 2000-2018. Below is a link to the original dataset.

Content

The figure below shows World GDP over time.

## Warning in right_join(., world_map, by = c(Country = "region")): Each row in `x` is expected to match at most 1 row in `y`.
## ℹ Row 1 of `x` matches multiple rows.
## ℹ If multiple matches are expected, set `multiple = "all"` to silence this
##   warning.

## Warning in right_join(., world_map, by = c(Country = "region")): Each row in `x` is expected to match at most 1 row in `y`.
## ℹ Row 1 of `x` matches multiple rows.
## ℹ If multiple matches are expected, set `multiple = "all"` to silence this
##   warning.

Findings

Looking at the energy usage at Amherst College inspired us to to explore other topics of sustainability in the world, and how countries differ in their sustainability. This directly lead to our interest in examining renewable energy consumption for each country on a map, by using a choropleth. Moreover, we used gganimate in order to distinguish between the change in renewable energy consumption from yearly changes. Renewable energy consumption is the proportion of energy that comes from renewable energy sources. This led us to looking at GDP as well, which stands for Gross Domestic Product. GDP is a measure for a countries economic output, as it measures a countries value of goods and services produced in their own country. Often countries with higher GDP have greater standards of living. We also look at annual based emissions of carbon dioxide, which is the amount of carbon dioxide that is released into the atmosphere. Increased emissions are often caused by burning fossil fuels and large industrialism. Another variable we looked at is life expectancy at birth which is strongly related to a country’s economic status and health care oppertunities. The final variable is access to electricity, and it is affected by a country’s economic status as well.

Visualizations

Visualizations, particularly interactive ones, will be well-received. That said, do not overuse visualizations. You may be better off with one complicated but well-crafted visualization as opposed to many quick-and-dirty plots. Any plots should be well-thought-out, properly labeled, informative, and visually appealing.

If you want to include dynamic visualizations or tables, you should explore your options from packages that are built from htmlwidgets. These htmlwidgets-based packages offer ways to build lighterweight, dynamic visualizations or tables that don’t require an R server to run! A more complete list of packages is available on the linked website, but a short list includes:

  • plotly: Interactive graphics with D3
  • leaflet: Interactive maps with OpenStreetMap
  • dygraphs: Interactive time series visualization
  • visNetwork: Network graph visualization vis.js
  • sparkline: Small inline charts
  • threejs: Interactive 3D graphics

Tables

DT package

The DT package is great for making dynamic tables that can be displayed, searched, and filtered by the user without needing an R server or Shiny app!

Note: you should load any packages you use in the setup code chunk as usual. The library() functions are shown below just for demonstration.

library(DT)
mtcars %>% 
  select(mpg, cyl, hp) %>% 
  datatable(colnames = c("MPG", "Number of cylinders", "Horsepower"),
            filter = 'top',
            options = list(pageLength = 10, autoWidth = TRUE))

kableExtra package

You can also use kableExtra for customizing HTML tables.

library(kableExtra)
summary(cars) %>%
  kbl(col.names = c("Speed", "Distance"),
      row.names = FALSE) %>%
  kable_styling(bootstrap_options = "striped",
                full_width = FALSE) %>%
  row_spec(0, bold = TRUE) %>%
  column_spec(1:2, width = "1.5in") 
Speed Distance
Min. : 4.0 Min. : 2.00
1st Qu.:12.0 1st Qu.: 26.00
Median :15.0 Median : 36.00
Mean :15.4 Mean : 42.98
3rd Qu.:19.0 3rd Qu.: 56.00
Max. :25.0 Max. :120.00

Images

Images and gifs can be displayed using code chunks:

"Safe Space" by artist Kenesha Sneed

“Safe Space” by artist Kenesha Sneed

This is a figure caption

This is a figure caption

You may also use Markdown syntax for displaying images as shown below, but code chunks offer easier customization of the image size and alignment.

This is another figure caption

Either way, the file path can be a local path within your project directory or a URL for an image hosted online. This syntax works for PNG, PDF, JPG, and even GIF formats.

Limitations & Conclusions

Limitations

There were a few limitations of our work. First, as with most large datasets, there was some missing data. We had to pick and chose certain variables that had the most data. By dropping the na’s, we inevitably lose the ability to broaden the scope of our analysis. With the world sustainability dataset, the data was collected from 173 different countries over 19 years. This is a huge amount of data with large variability so we need to be careful. Due to the varying economic status of each country, it’s hard to gather information for all variables. We proceeded with caution in our analysis.

As for our Shiny app, we only had data from four out of the 34 residence halls at Amherst College. These four dorms are freshman dorms so we shouldn’t conclude that our findings represent the energy consumption for the Amherst College student body as a whole.

Conclusions

We hope through this blog post that readers are aware of the importance of sustainability in the long run. As Earth gets warmer by the day, everyone can do their part to reduce their carbon footprint. Sustainability is crucial for the health of our planet and the well-being of future generations. By making small changes in our daily lives, we can all do our part to reduce our carbon footprint and live more sustainably. Whether it’s by using reusable bags, reducing energy consumption, supporting sustainable businesses, or choosing eco-friendly products, every action counts. It’s important to remember that we are all responsible for the impact we have on the environment, and by taking steps toward sustainability, we can make a significant difference.

You can make a bulleted list like this:

  • item 1
  • item 2
  • item 3

Numbered list

You can make a numbered list like this

  1. First thing I want to say
  2. Second thing I want to say
  3. Third thing I want to say

Column formatting

Content Column 1

How to Increase Sustainability:

Content Column 2

Customizing your blog design

As a final detail only if you have time, you can explore options for customizing the style of your blog. By default, we are using the readthedown theme from the rmdformats package (see Line 6 of this file if you want to switch out themes).

Theme

You can use the rmdformats package to play around with some pre-built themes. There are, I’m sure, many many many more similar packages with built in themes, or you can look into how to include a CSS code chunk to customize aspects of a theme.

Using the rmdformats package, you can change the theme itself (Line 6):

  • rmdformats::readthedown
  • rmdformats::downcute
    • For downcute only, you can add a new indented line below Line 6 with the code downcute_theme: "chaos" for the downcute chaos theme
  • rmdformats::robobook
  • rmdformats::material

You can explore additional YAML options by looking at the rmdformats package page or running, for example, ?rmdformats::readthedown() to see the help documentation for a particular theme from the package.

Synax highlighting

You can also change the code chunk syntax highlighting option (Line 7, highlight):

  • "default"
  • "tango"
  • "pygments"
  • "kate"
  • "monochrome"
  • "espresso"
  • "zenburn"
  • "haddock"
  • "textmate"
  • NULL for no syntax highlighting (not recommended)

Font size, type, and other customization

Further customization requires adding a CSS style file or code chunk or incorporating other development options. Customization beyond the rmdformats package should be your lowest and final priority for the project. Ensure your content is fully prepared first.

References

  1. Baumer, B. S., Kaplan, D. T., and Horton, N. J. (2021), Modern Data Science with R (2nd ed.), Boca Raton, FL: CRC Press.
  1. “U.S. electricity consumption 2021.” Statista, 25 January 2023, https://www.statista.com/statistics/201794/us-electricity-consumption-since-1975/. Accessed 2 May 2023.
  1. “Quick and easy ways to live a more sustainable life. | Thing 1, Vacances, Plastique.” Pinterest, https://www.pinterest.com/pin/520025088223297694/. Accessed 3 May 2023.
  1. “10 tips on how you can be more sustainable.” Cellugy, 3 February 2022, https://www.cellugy.com/blog/10-tips-on-how-you-can-be-more-sustainable. Accessed 3 May 2023.
  1. Jones, Benji. “Pakistan flooding: How melting glaciers fueled the disaster.” Vox, 30 August 2022, https://www.vox.com/science-and-health/2022/8/30/23327341/pakistan-flooding-monsoon-melting-glaciers-climate-change. Accessed 2 May 2023.
  1. “Home.” Kaggle, https://www.kaggle.com/datasets/truecue/worldsustainabilitydataset?resource=download. Accessed 2 May 2023.
  1. Wickham H, Averick M, Bryan J, Chang W, McGowan LD, François R, Grolemund G, Hayes A, Henry L, Hester J, Kuhn M, Pedersen TL, Miller E, Bache SM, Müller K, Ooms J, Robinson D, Seidel DP, Spinu V, Takahashi K, Vaughan D, Wilke C, Woo K, Yutani H (2019). “Welcome to the tidyverse.” Journal of Open Source Software, 4(43), 1686. doi:10.21105/joss.01686 https://doi.org/10.21105/joss.01686.
  1. Robinson D, Hayes A, Couch S (2023). broom: Convert Statistical Objects into Tidy Tibbles. R package version 1.0.3, https://CRAN.R-project.org/package=broom.
  1. Slowikowski K (2023). ggrepel: Automatically Position Non-Overlapping Text Labels with ‘ggplot2’. R package version 0.9.3, https://CRAN.R-project.org/package=ggrepel.
  1. Schloerke B, Cook D, Larmarange J, Briatte F, Marbach M, Thoen E, Elberg A, Crowley J (2021). GGally: Extension to ‘ggplot2’. R package version 2.1.2, https://CRAN.R-project.org/package=GGally.
  1. Wickham H, Hester J, Bryan J (2022). readr: Read Rectangular Text Data. R package version 2.1.3, https://CRAN.R-project.org/package=readr.
  1. Becker OScbRA, Minka ARWRvbRBEbTP, Deckmyn. A (2022). maps: Draw Geographical Maps. R package version 3.4.1, https://CRAN.R-project.org/package=maps.
  1. Cheng J, Karambelkar B, Xie Y (2023). leaflet: Create Interactive Web Maps with the JavaScript ‘Leaflet’ Library. R package version 2.1.2, https://CRAN.R-project.org/package=leaflet.
  1. Pebesma, E., 2018. Simple Features for R: Standardized Support for Spatial Vector Data. The R Journal 10 (1), 439-446, https://doi.org/10.32614/RJ-2018-009
  1. Bryan J (2023). gapminder: Data from Gapminder. R package version 1.0.0, https://CRAN.R-project.org/package=gapminder.
  1. H. Wickham. ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York, 2016.
  1. Benjamin S. Baumer, Daniel T. Kaplan, Nicholas J. Horton (2021). Modern Data Science with R. 2nd edition, Chapman and Hall/CRC Press: Boca Raton, 1–673. URL https://www.routledge.com/Modern-Data-Science-with-R/Baumer-Kaplan-Horton/p/book/9780367191498.
  1. Wickham H, François R, Henry L, Müller K, Vaughan D (2023). dplyr: A Grammar of Data Manipulation. R package version 1.1.0, https://CRAN.R-project.org/package=dplyr.
  1. Pedersen T, Robinson D (2022). gganimate: A Grammar of Animated Graphics. R package version 1.0.8, https://CRAN.R-project.org/package=gganimate.
  1. Pedersen T (2022). transformr: Polygon and Path Transformations. R package version 0.1.4, https://CRAN.R-project.org/package=transformr.
  1. Ooms J (2022). gifski: Highest Quality GIF Encoder. R package version 1.6.6-1, https://CRAN.R-project.org/package=gifski.
  1. Urbanek S (2022). png: Read and write PNG images. R package version 0.1-8, https://CRAN.R-project.org/package=png.